import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [{
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/',
    name: 'Main',
    component: () => import('../views/Main.vue'),
    children: [{
        path: '/home',
        name: 'Home',
        component: () => import('../views/Home.vue'),

      },
      {
        path: '/menu',
        name: 'Menu',
        component: () => import('../views/Menu.vue'),

      },
      {
        path: '/shopbag',
        name: 'Shopbag',
        component: () => import('../views/Shopbag.vue'),

      },
      {
        path: '/mine',
        name: 'Mine',
        component: () => import('../views/Mine.vue'),

      }
    ],
    redirect: '/home'
  },
  {
    path: '/detail:pid',
    name: 'Detail',
    component: () => import('../views/Detail')
  },
  {
    path: '/addressedit:aid',
    name: 'AddressEdit',
    component: () => import('../views/AddressEdit')
  },
  {
    path: '/addresslist',
    name: 'AddressList',
    component: () => import('../views/AddressList')
  },
  {
    path: '/submit:sids',
    name: 'Submit',
    component: () => import('../views/Submit')
  },
  {
    path: '/order',
    name: 'Order',
    component: () => import('../views/Order')
  },
  {
    path: '/collection',
    name: 'Collection',
    component: () => import('../views/Collection')
  },
  {
    path: '/personal',
    name: 'Personal',
    component: () => import('../views/Personal')
  },
  {
    path: '/safe',
    name: 'Safe',
    component: () => import('../views/Safe')
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import('../views/Search')
  },
  {
    path: '/replacehead',
    name: 'ReplaceHead',
    component: () => import('../views/ReplaceHead')
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router